package jp.sourceforge.akjrcp.ui;

import java.io.FilenameFilter;

import jp.sourceforge.akjrcp.akj_betas.Messages;

import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.ProgressBar;

public class ProgressAndQuee extends Composite{
	
	private EditableList dataList;
	private Button cancelButton;
	private Button cancelAllButton;

	private FilenameFilter filenameFilter;
	private ProgressBar progressBar;
	private Label centerLabel;
	private Label headerLabel;
	public FilenameFilter getFilenameFilter() {
		return filenameFilter;
	}
	public void setFilenameFilter(FilenameFilter filenameFilter) {
		this.filenameFilter = filenameFilter;
	}
	public ProgressAndQuee(Composite parent, int style) {
		super(parent, style);
		this.setLayout(new GridLayout(1,false));
		
		headerLabel=new Label(this,SWT.NULL);
		headerLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
		
		Composite bar_and_cancel=new Composite(this,SWT.NONE);
		bar_and_cancel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
		bar_and_cancel.setLayout(new GridLayout(2,false));
		
		
		
		progressBar = new ProgressBar(bar_and_cancel,SWT.NONE);
		progressBar.setMaximum(100);
		
		//TODO:should work;
		progressBar.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
		
		cancelButton = new Button(bar_and_cancel,SWT.NULL);
		cancelButton.setText(Messages.getString("cancel"));
		
		centerLabel=new Label(this,SWT.NULL);
		centerLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
		
		
		
		dataList = new EditableList(this,SWT.NULL);
		dataList.getTable().setLayoutData(new GridData(GridData.FILL_BOTH));
		
		cancelAllButton=new Button(this,SWT.NULL);
		cancelAllButton.setText(Messages.getString("cancel_all"));
		
	}
	public void setHeaderLabelText(String text){
		headerLabel.setText(text);
	}
	public void setCenterLabelText(String text){
		centerLabel.setText(text);
	}
	public void addData(EditableListData data){
		//some how ,add is wrong
	dataList.addData(data);
	redraw();
	}
	public EditableList getEditableList(){
		return dataList;
	}
	public Button getCancelButton(){
		return cancelButton;
	}
	public Button getCancelAllButton(){
		return cancelAllButton;
	}
	public ProgressBar getProgressBar() {
		return progressBar;
	}
	

	
}
